package cn.qh.com.exception;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;


/**
 * 统一的异常信息类
 *
 * @author 孟佳林
 * @since 2021-11-26 09:46:13
 */
@Configuration
@Component
//需要自己改
@ConfigurationProperties(prefix = "qh")
//需要自己改
@PropertySource(value = "classpath:exception.properties", encoding = "utf-8")
@Data
public class ExceptionCodeConfiguration {
    protected Map<Integer, String> code = new HashMap<>();

    public String getMessage(int code) {
        return this.code.get(code);
    }
}
